home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / gnustuff / minix / mdbtar~1.z / mdbtar~1 / out.h < prev    next >
Encoding:
C/C++ Source or Header  |  1989-05-11  |  3.2 KB  |  117 lines

  1. /*
  2.  * (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
  3.  * See the copyright notice in the file "../Copyright".
  4.  */
  5. /*
  6.  * output format for ACK assemblers
  7.  */
  8. #ifndef ushort
  9. #define ushort    unsigned short
  10. #endif ushort
  11.  
  12. struct outhead {
  13.     ushort     oh_magic;    /* magic number */
  14.     ushort     oh_stamp;    /* version stamp */
  15.     ushort    oh_flags;    /* several format flags */
  16.     ushort    oh_nsect;    /* number of outsect structures */
  17.     ushort    oh_nrelo;    /* number of outrelo structures */
  18.     ushort    oh_nname;    /* number of outname structures */
  19.     long    oh_nemit;    /* sum of all os_flen */
  20.     long    oh_nchar;    /* size of string area */
  21. };
  22.  
  23. #define O_MAGIC    0x0201        /* magic number of output file */
  24. #define    O_STAMP    0        /* version stamp */
  25. #define MAXSECT    64        /* Maximum number of sections */
  26.  
  27. #define    HF_LINK    0x0004        /* unresolved references left */
  28. #define    HF_8086    0x0008        /* os_base specially encoded */
  29.  
  30. struct outsect {
  31.     long     os_base;    /* startaddress in machine */
  32.     long    os_size;    /* section size in machine */
  33.     long    os_foff;    /* startaddress in file */
  34.     long    os_flen;    /* section size in file */
  35.     long    os_lign;    /* section alignment */
  36. };
  37.  
  38. struct outrelo {
  39.     char    or_type;    /* type of reference */
  40.     char    or_sect;    /* referencing section */
  41.     ushort    or_nami;    /* referenced symbol index */
  42.     long    or_addr;    /* referencing address */
  43. };
  44.  
  45. struct outname {
  46.     union {
  47.       char    *on_ptr;    /* symbol name (in core) */
  48.       long    on_off;        /* symbol name (in file) */
  49.     }    on_u;
  50. #define on_mptr    on_u.on_ptr
  51. #define on_foff    on_u.on_off
  52.     ushort    on_type;    /* symbol type */
  53.     ushort    on_desc;    /* debug info */
  54.     long    on_valu;    /* symbol value */
  55. };
  56.  
  57. /*
  58.  * relocation type bits
  59.  */
  60. #define RELSZ    0x07        /* relocation length */
  61. #define RELO1       1        /* 1 byte */
  62. #define RELO2       2        /* 2 bytes */
  63. #define RELO4       4        /* 4 bytes */
  64. #define RELPC    0x08        /* pc relative */
  65. #define RELBR    0x10        /* High order byte lowest address. */
  66. #define RELWR    0x20        /* High order word lowest address. */
  67.  
  68. /*
  69.  * section type bits and fields
  70.  */
  71. #define S_TYP    0x007F        /* undefined, absolute or relative */
  72. #define S_EXT    0x0080        /* external flag */
  73. #define S_ETC    0x7F00        /* for symbolic debug, bypassing 'as' */
  74.  
  75. /*
  76.  * S_TYP field values
  77.  */
  78. #define S_UND    0x0000        /* undefined item */
  79. #define S_ABS    0x0001        /* absolute item */
  80. #define S_MIN    0x0002        /* first user section */
  81. #define S_MAX    S_TYP        /* last user section */
  82.  
  83. /*
  84.  * S_ETC field values
  85.  */
  86. #define S_SCT    0x0100        /* section names */
  87. #define S_LIN    0x0200        /* hll source line item */
  88. #define S_FIL    0x0300        /* hll source file item */
  89. #define S_MOD    0x0400        /* ass source file item */
  90. #define S_COM    0x1000        /* Common name. */
  91.  
  92. /*
  93.  * structure format strings
  94.  */
  95. #define SF_HEAD        "22222244"
  96. #define SF_SECT        "44444"
  97. #define SF_RELO        "1124"
  98. #define SF_NAME        "4224"
  99.  
  100. /*
  101.  * structure sizes (bytes in file; add digits in SF_*)
  102.  */
  103. #define SZ_HEAD        20
  104. #define SZ_SECT        20
  105. #define SZ_RELO        8
  106. #define SZ_NAME        12
  107.  
  108. /*
  109.  * file access macros
  110.  */
  111. #define BADMAGIC(x)    ((x).oh_magic!=O_MAGIC)
  112. #define OFF_SECT(x)    SZ_HEAD
  113. #define OFF_EMIT(x)    (OFF_SECT(x) + ((long)(x).oh_nsect * SZ_SECT))
  114. #define OFF_RELO(x)    (OFF_EMIT(x) + (x).oh_nemit)
  115. #define OFF_NAME(x)    (OFF_RELO(x) + ((long)(x).oh_nrelo * SZ_RELO))
  116. #define OFF_CHAR(x)    (OFF_NAME(x) + ((long)(x).oh_nname * SZ_NAME))
  117.